package com.joyoung.sweep.utils.blue;

import android.content.Context;
import android.view.Gravity;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.joyoung.sweep.model.BaseResult;


public class T {

    /**
     * 带图标的toast
     */
    public static void show(Context context, String content, int icon) {
        Toast toast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER, 0, 0);
        LinearLayout toastView = (LinearLayout) toast.getView();
        ImageView imageView = new ImageView(context);
        imageView.setImageResource(icon);
        toastView.addView(imageView, 0);
        toast.show();
    }

    /**
     * @param context
     * @param content
     */
    public static void show(Context context, String content) {
        if (null != context) {
            Toast toast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
        }
    }

}
